<template>
  <div class="add-form">
    <el-dialog :title="titleInfo.text+titleInfo.pageTitle" :visible.sync="dialogFormVisible">
      <el-form
        :rules="ruleInline"
        ref="dataForm"
        :model="dataForm"
        label-position="left"
        label-width="150px"
        style="width: 80%; margin-left:10px;"
      >
        <el-form-item label="方向名称" prop="name">
          <el-input v-model="dataForm.name" placeholder="请输入内容"></el-input>
        </el-form-item>
        <el-form-item label="编码" prop="code">
          <el-input v-model="dataForm.code"></el-input>
        </el-form-item>

        <el-form-item label="兴趣标签" prop="label">
            <el-radio v-model="dataForm.label" label="1">是</el-radio>
            <el-radio v-model="dataForm.label" label="2">否</el-radio>
        </el-form-item>
        <el-form-item label="是否可用" prop="isShow">
            <el-radio v-model="dataForm.isShow" label="1">可用</el-radio>
            <el-radio v-model="dataForm.isShow" label="2">不可用</el-radio>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormH">取消</el-button>
        <el-button type="primary" @click="createData">保存</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: 'CategoryAdd',
  props: {
    titleInfo: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      dialogFormVisible: false,
      dataForm: {
        name: '',
        code: '',
        label: '1',
        isShow: '1'
      },
      // 表单验证
      ruleInline: {
        name: [
          { required: true, message: '方向名称不能为空', trigger: 'blur' }
        ],
        code: [
          { required: true, message: '编码不能为空', trigger: 'blur' }
        ]
      }
    }
  },
  computed: {},
  methods: {
    // 弹层显示
    dialogFormV() {
      this.dialogFormVisible = true
    },
    // 弹层隐藏
    dialogFormH() {
      this.dialogFormVisible = false
    }
  },
  // 挂载结束

  mounted: function() {},
  // 创建完毕状态
  created() {

  },
  // 组件更新
  updated: function() {}
}
</script>
<style>
.el-form--label-left .el-form-item__label {
  text-align: right;
}
.el-form-item--medium {
  margin-bottom: 22px;
}
.el-dialog__footer {
  text-align: center;
}
</style>
